#! /bin/sh
echo '####################开始自动部署####################'
path=`pwd` #当前路径
tomcatPath=/usr/local/src/apache-tomcat-8.0.45/  #指定tomcat文件目录名称
cd ../$tomcatPath/bin #进入tomcat的bin目录
echo '$tomcatPath/bin'
PID=$(ps -fu `whoami`|grep tomcat|grep -v grep|awk '{print $2}')
if [ -z "$PID" ];then
 echo "no tomcat process"
else
./shutdown.sh #停止tomcat服务
echo './shutdown.sh'
fi
sleep 1 #休眠1s
cd ../webapps #进入tomcat的webapps目录
echo 'cd ../webapps'
rm -fr ROOT #删除test文件目录
echo 'rm -rf ROOT'
mv ROOT.war ROOT.war.$(date +%Y%m%d) #备份webapps下的test16
echo 'back'
\cp /home/test/write/marketingplatform.war /usr/local/src/apache-tomcat-8.0.45/webapps/ROOT.war
echo '\cp /home/test/write/marketingplatform.war /usr/local/src/apache-tomcat-8.0.45/webapps/ROOT.war'
sleep 1 #休眠1s
cd ../bin
echo '../bin'
./startup.sh #启动tomcat服务
echo './startup.sh'
sleep 30 #休眠30s
\cp /home/test/write/simkai.ttf  /usr/local/src/apache-tomcat-8.0.45/webapps/ROOT/WEB-INF/classes/fonts/simkai.ttf
echo '\cp /home/test/write/simkai.ttf  /usr/local/src/apache-tomcat-8.0.45/webapps/ROOT/WEB-INF/classes/fonts/simkai.ttf'
\cp /home/test/write/simsun.ttf  /usr/local/src/apache-tomcat-8.0.45/webapps/ROOT/WEB-INF/classes/fonts/simsun.ttf
echo '\cp /home/test/write/simsun.ttf  /usr/local/src/apache-tomcat-8.0.45/webapps/ROOT/WEB-INF/classes/fonts/simsun.ttf'
cd /home/cn.hpchem/cc-admin
echo 'cd /home/cn.hpchem/cc-admin'
git pull
echo 'git pull'
cd ../cc-pc
echo 'cd ../cc-pc'
git pull
echo 'git pull'
cd ../cc-wx
echo 'cd ../cc-wx'
git pull;
echo 'git pull'
echo '####################部署结束####################'